#pragma once
#include <string>
#include <odb/core.hxx>


namespace im{
    #pragma db object table("relation")
    class Relation{
    public:
        Relation(){}
        Relation(const std::string& uid, const std::string& pid)
            :_user_id(uid),_peer_id(pid){}

        void user_id(const std::string& uid){ _user_id = uid; }
        std::string user_id() const { return _user_id; }

        void peer_id(const std::string& pid){ _peer_id = pid; }
        std::string peer_id() const { return _peer_id; }

    private:
        friend class odb::access;
        #pragma db id auto
        unsigned int _id;
        #pragma db type("VARCHAR(64)") index
        std::string _user_id;
        #pragma db type("VARCHAR(64)") index
        std::string _peer_id;
    };
}